package Chapter08.Homework13;

/**
 * @author 杨森
 * @date 2022年10月11日 10:57
 */
public class Teacher extends Person {
    private int work_age;

    public Teacher(String name, char sex, int age, int work_age) {
        super(name, sex, age);
        this.work_age = work_age;
    }


    public int getWork_age() {
        return work_age;
    }

    public void setWork_age(int work_age) {
        this.work_age = work_age;
    }

    public void teach(){
        System.out.println(getName()+"承诺，我会认真教课");
    }

    @Override
    public String play() {
        return super.play()+"象棋";
    }

    public void printInfo(){
        System.out.println("老师的信息：");
        System.out.println(super.basicInfo());
        System.out.println("工龄"+work_age);
        teach();
        System.out.println(play());
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("Teacher{");
        sb.append("work_age=").append(work_age);
        sb.append(super.toString());
        sb.append('}');
        return sb.toString();
    }
}
